/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.engagesoft.cashflow.entidades;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author rchajin
 */
@Entity
@Table(name = "concepto_tipo_doc")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ConceptoTipoDoc.findAll", query = "SELECT c FROM ConceptoTipoDoc c"),
    @NamedQuery(name = "ConceptoTipoDoc.findByIdConceptoTipoDoc", query = "SELECT c FROM ConceptoTipoDoc c WHERE c.idConceptoTipoDoc = :idConceptoTipoDoc"),
    @NamedQuery(name = "ConceptoTipoDoc.findByNombre", query = "SELECT c FROM ConceptoTipoDoc c WHERE c.nombre = :nombre"),
    @NamedQuery(name = "ConceptoTipoDoc.findByIndHabilitadosucuarsal", query = "SELECT c FROM ConceptoTipoDoc c WHERE c.indHabilitadosucuarsal = :indHabilitadosucuarsal")})
public class ConceptoTipoDoc implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_concepto_tipo_doc")
    private Integer idConceptoTipoDoc;
    @Size(max = 80)
    @Column(name = "nombre")
    private String nombre;
    @Basic(optional = false)
    @NotNull
    @Column(name = "indHabilitado_sucuarsal")
    private boolean indHabilitadosucuarsal;
    @OneToMany(mappedBy = "idConceptoTipoDoc")
    private Collection<TipoDocumento> tipoDocumentoCollection;

    public ConceptoTipoDoc() {
    }

    public ConceptoTipoDoc(Integer idConceptoTipoDoc) {
        this.idConceptoTipoDoc = idConceptoTipoDoc;
    }

    public ConceptoTipoDoc(Integer idConceptoTipoDoc, boolean indHabilitadosucuarsal) {
        this.idConceptoTipoDoc = idConceptoTipoDoc;
        this.indHabilitadosucuarsal = indHabilitadosucuarsal;
    }

    public Integer getIdConceptoTipoDoc() {
        return idConceptoTipoDoc;
    }

    public void setIdConceptoTipoDoc(Integer idConceptoTipoDoc) {
        this.idConceptoTipoDoc = idConceptoTipoDoc;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public boolean getIndHabilitadosucuarsal() {
        return indHabilitadosucuarsal;
    }

    public void setIndHabilitadosucuarsal(boolean indHabilitadosucuarsal) {
        this.indHabilitadosucuarsal = indHabilitadosucuarsal;
    }

    @XmlTransient
    public Collection<TipoDocumento> getTipoDocumentoCollection() {
        return tipoDocumentoCollection;
    }

    public void setTipoDocumentoCollection(Collection<TipoDocumento> tipoDocumentoCollection) {
        this.tipoDocumentoCollection = tipoDocumentoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idConceptoTipoDoc != null ? idConceptoTipoDoc.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ConceptoTipoDoc)) {
            return false;
        }
        ConceptoTipoDoc other = (ConceptoTipoDoc) object;
        if ((this.idConceptoTipoDoc == null && other.idConceptoTipoDoc != null) || (this.idConceptoTipoDoc != null && !this.idConceptoTipoDoc.equals(other.idConceptoTipoDoc))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.engagesoft.cashflow.entidades.ConceptoTipoDoc[ idConceptoTipoDoc=" + idConceptoTipoDoc + " ]";
    }
    
}
